package dxp;
import java.math.*;
import java.util.Random;
import java.util.zip.*;
import sun.misc.CRC16;



public class Test {
	public static String mod2(String s1,String s2)
	{
		StringBuffer res = new StringBuffer();
		for(int i = 0 ;i < s1.length();i++)
		{
			if(s1.charAt(i)==s2.charAt(i))
				res.append('0');
			else
				res.append('1');
		}
		return res.toString();
	}
  public static void main(String args[]){
	  /*CRC16 c = new 
	  CRC16();
	  c.reset();
	  System.out.println(c.value);*/
	  
	BigInteger b = new BigInteger(128,1,new Random());
	  
	  Number128 num = new Number128(b);
	  String bitArray = num.getBitArray();
	  
	  System.out.println(bitArray);
	  
//	  CRC16 crc16 = new CRC16();
//	  int crc = crc16.value; 
	  int crc = (int)Math.pow(2, 16) +
	  (int)Math.pow(2, 15) +
	  (int)Math.pow(2, 2) + 1;
	  
	  String strCRC16 = "11000000000000101";
	  String str1 = new String();
	  
	  StringBuffer res = new StringBuffer();
	  for(int i = 0;i < 128;i++)
	  {
		  //String str1 = bitArray.substring(i, i+18);
		  //String res = mod2(str1,strCRC16);
		  //for(int j = 0;)
		  
	  }
	  
	  
	  BitString bs = new BitString(str1,strCRC16,17);
	  	  
	  byte []arr = b.toByteArray();
//	  StringBuffer sb = new StringBuffer(); 
//	  System.out.println(sb);
	  
	  for(int i = 0;i < 16;i ++)
	  {
		  System.out.print(arr[i]);
	  }
	  System.out.println();
	  System.out.println(crc);
	  System.out.println(b);
	  System.out.println(b.toString());
	  System.out.println(b.toByteArray());
	  
//	  System.out.println(crc16);
//	  System.out.println(crc);
	  
	  
	 
  }
}
